import configparser
from datetime import datetime, timedelta


def this_monday():
    """
    :function: 获取本周周一日期
    :return: 返回周一的日期
    :return_type: string
    """
    today = datetime.now()
    return datetime.strftime(today - timedelta(today.weekday() + 1), "%Y-%m-%d")


def read_properties(filename: str) -> configparser.ConfigParser:
    config = configparser.ConfigParser()
    config.read(filename)
    return config


def save_properties(filename: str, config: configparser.ConfigParser):
    # 保存修改后的数据
    with open(filename, 'w') as f:
        config.write(f)
